﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Apollo.Web;

namespace Apollo.Website
{
    public partial class ClearCache : System.Web.UI.Page, IApolloPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Apollo.Application.ClearCache();
                LabelWarn.Text = "Cache was cleared!";
            }
            catch (Exception ex)
            {
                LabelWarn.Text = "FAILED: " + ex.Message;
            }
        }

        public int SelectedMenuItemID
        {
            get { return Apollo.Application.Meta<Apollo.MenuItem>().Single<Apollo.MenuItem>(mi => mi.Name == "Clear cache").Id; }
        }

        public int SelectedRootMenuItemId
        {
            get { return Apollo.Application.Meta<Apollo.MenuItem>().Single<Apollo.MenuItem>(mi => mi.Name == "Settings").Id; }
        }
    }
}